Hi I need to assign values for arrays.
My Model
public partial class TaxInfoTaxFiled
{
public System.Guid TaxInfoTaxFieldID { get; set; }
public Nullable<System.Guid> TaxInfoID { get; set; }
public Nullable<System.Guid> TaxFieldID { get; set; }
public Nullable<System.Guid> FieldTypeID { get; set; }
public string FieldValue { get; set; }
}
public partial class TaxField
{
public System.Guid TaxFieldID { get; set; }
public string DisplayName { get; set; }
public string PrintName { get; set; }
}
My ViewModel
public string TinNo { get; set; }
public string CstNo { get; set; }
public string ExciseRegNo { get; set; }
public string PanNo { get; set; }
public string ServiceTaxNo { get; set; }
public string CinNo { get; set; }
public List<TaxField> TaxField { get; set; }
public List<TaxInfoTaxFiled> TaxInfoTaxFiled { get; set; }
}
My Controller
ArrayList Alist = new ArrayList();
{
Alist.Add("FD713788-B5AE-49FF-8B2C-F311B9CB0CC4");
Alist.Add("64B512E7-46AE-4989-A049-A446118099C4");
Alist.Add("376D45C8-659D-4ACE-B249-CFBF4F231915");
Alist.Add("59A2449A-C5C6-45B5-AA00-F535D83AD48B");
Alist.Add("03ADA903-D09A-4F53-8B67-7347A08EDAB1");
Alist.Add("2F405521-06A0-427C-B9A3-56B8931CFC57");
}
ArrayList objValue=new ArrayList();
{
objValue.Add(viewmodel.TinNo);
objValue.Add(viewmodel.CstNo);
objValue.Add(viewmodel.PanNo);
objValue.Add(viewmodel.CinNo);
objValue.Add(viewmodel.ExciseRegNo);
objValue.Add(viewmodel.ServiceTaxNo);
}
foreach (var tax in viewmodel.TaxInfoTaxFiled)
{
foreach (var i in Alist)
{
tax.FieldTypeID = Guid.Parse(i.ToString());
}
foreach (var j in objValue)
{
tax.FieldValue = j.ToString();
}
db.TaxInfoTaxFiled.Add(tax);
}
My View
My View Contain Six Fields
TinNo, CstNo, PanNo, ServiceTaxNo, CinNo, ExciseRegNo.
I want to change the Controller Code Especially the Arraylist to Array
I need to Assign the array Size to 6 . Is there is possible to use 2 dimensional array. Y im asking like this means I need to calucualte the values in For loop in this format
eg i[0]j[0], i[1]j[1], i[2]j[2], i[3]j[3], i[4]j[4],i[5]j[5], i[6]j[6]
then only I can save all the fields values (TinNo, CstNo, PanNo, ServiceTaxNo, CinNo, ExciseRegNo) in same column in next next row and their id's in TaxFieldID Column.
TaxFieldID FieldValue
FD713788-B5AE-49FF-8B2C-F311B9CB0CC4 TinNo
64B512E7-46AE-4989-A049-A446118099C4 CstNo
same as like I need to save the values in Table for that I need to assign the Array size as 6 and Have to store the default GUID's to that array
eg
a[i]
a[0]=FD713788-B5AE-49FF-8B2C-F311B9CB0CC4
a[1]=64B512E7-46AE-4989-A049-A446118099C4
eg int a[4]={10,20,30,40}
How to do this and how to assign data type for these default Guid values in array.
Thanks