Esempio n. 1
0
        public cConsignmentEx()
        {
            CNote = new cConsignmentItem();
            list_BacterialInsiminateClass = new List <cListItem>();
            list_Contractor  = new List <cListItem>();
            list_PurityGroup = new List <cListItem>();
            list_Sort        = new List <cListItem>();
            list_Status      = new List <cListItem>();

            //setMode('D');
        }
Esempio n. 2
0
        //---- INSERT накладная
        public void srv_work_Consignment(cConsignmentItem item,cFilter filter)
        {
            try
            {
                DataManager.ins_upd_ConsignmentNote(item);

                client.notifyWorkConsignmentItem(1);
                client.receiveConsignmentList(DataManager.sel_ConsignmentNote(filter));
            }
            catch 
            {
                client.notifyWorkConsignmentItem(0);
            }
        }
Esempio n. 3
0
        //------ INSERT UPDATE накладной
        public static int ins_upd_ConsignmentNote(cConsignmentItem C)
        {
            int ret = 0;

            using (SqlConnection conn = new SqlConnection(CommManager.ConnectionString))
            {
                SqlCommand cmd = new SqlCommand("lp_ins_upd_ConsignmentNote");
                conn.Open();
                cmd.Connection  = conn;
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@ConsignmentNoteID", objectOrNull(C.ID));
                cmd.Parameters.AddWithValue("@DT_In", objectOrNull(C.DT_In));
                cmd.Parameters.AddWithValue("@DT_Out", objectOrNull(C.DT_Out));
                cmd.Parameters.AddWithValue("@ConsignmentNote_N", C.ConsigmentNote_N);
                cmd.Parameters.AddWithValue("@Contractor_ID", objectOrNull(C.item_Contractor.ID));
                cmd.Parameters.AddWithValue("@Sort_ID", objectOrNull(C.item_Sort.ID));
                cmd.Parameters.AddWithValue("@PurityGroup_ID", objectOrNull(C.item_PurityGroup.ID));
                cmd.Parameters.AddWithValue("@BacterialInsiminateClass_ID", objectOrNull(C.item_BacterialInsiminateClass.ID));
                cmd.Parameters.AddWithValue("@Status_ID", objectOrNull(C.item_Status.ID));

                cmd.Parameters.AddWithValue("@RichnessVal", objectOrNull(C.RichnessVal));
                cmd.Parameters.AddWithValue("@MassBaseRichnessVal", objectOrNull(C.MassBaseRichnessVal));
                cmd.Parameters.AddWithValue("@AcidityVal", objectOrNull(C.AcidityVal));
                cmd.Parameters.AddWithValue("@TemperatureVal", objectOrNull(C.TemperatureVal));
                cmd.Parameters.AddWithValue("@DensityVal", objectOrNull(C.DensityVal));
                cmd.Parameters.AddWithValue("@ProteinVal", objectOrNull(C.ProteinVal));

                cmd.Parameters.AddWithValue("@Comments", objectOrNull(C.Comments));
                cmd.Parameters.AddWithValue("@VolumeVal", objectOrNull(C.VolumeVal));
                cmd.Parameters.AddWithValue("@MassNetFactVal", objectOrNull(C.MassNetVal));


                //cmd.Parameters.Add("@rowcount_out", SqlDbType.Int);
                //cmd.Parameters["@rowcount_out"].Direction = ParameterDirection.Output;

                cmd.ExecuteNonQuery();
                ret = 1;

                //ret = (int)cmd.Parameters["@rowcount_out"].Value;

                conn.Close();
            }
            return(ret);
        }
Esempio n. 4
0
        public void srv_work_Consignment(cConsignmentItem item)
        {
            string t="";
            try
            {
                DataManager.ins_upd_ConsignmentNote(item);
                t = "Произведены изменения в таблице Consignments";
                foreach (MDSClient c in Clients.Values.ToArray())
                {
                    c.SendTableUpdated("Consignments");
                }
            }
            catch (Exception err)
            {
                foreach (MDSClient c in Clients.Values.ToArray())
                {
                    t = "Попытка вставки накладной не удалась, текст ошибки: " + err.Message;
                    c.SendMessage(t);
                } 
            }

            createNewMessage(t);
        }
Esempio n. 5
0
        //----- SELECT списка накладных или одной накладной ------------------------------
        public static List <cConsignmentItem> sel_ConsignmentNote(cFilterList filter)
        {
            List <cConsignmentItem> list = new List <cConsignmentItem>();

            using (SqlConnection conn = new SqlConnection(CommManager.ConnectionString))
            {
                SqlCommand cmd = new SqlCommand("lp_sel_ConsignmentNote");
                conn.Open();
                cmd.Connection  = conn;
                cmd.CommandType = CommandType.StoredProcedure;

                // @ConsignmentNoteID int = null
                // @BeginDT smalldatetime = null
                // @EndDT	smalldatetime = null
                // @StatusID int = null

                cmd.Parameters.AddWithValue("@ConsignmentNoteID", objectOrNull(filter.ConsignmentNoteID));
                cmd.Parameters.AddWithValue("@BeginDT", objectOrNull(filter.BeginDT));
                cmd.Parameters.AddWithValue("@EndDT", objectOrNull(filter.EndDT));
                cmd.Parameters.AddWithValue("@StatusID", objectOrNull(filter.StatusIDString));

                SqlDataReader Reader = cmd.ExecuteReader();

                while (Reader.Read())
                {
                    cConsignmentItem item = new cConsignmentItem();

                    if (!Reader.IsDBNull(Reader.GetOrdinal("ID")))
                    {
                        item.ID = (int)Reader["ID"];
                    }

                    if (!Reader.IsDBNull(Reader.GetOrdinal("DT_In")))
                    {
                        item.DT_In = (DateTime)Reader["DT_In"];
                    }

                    if (!Reader.IsDBNull(Reader.GetOrdinal("DT_Out")))
                    {
                        item.DT_Out = (DateTime)Reader["DT_Out"];
                    }

                    if (!Reader.IsDBNull(Reader.GetOrdinal("ConsignmentNote_N")))
                    {
                        item.ConsigmentNote_N = (string)Reader["ConsignmentNote_N"];
                    }

                    if (!Reader.IsDBNull(Reader.GetOrdinal("Contractor_ID")))
                    {
                        item.item_Contractor.ID = (int)Reader["Contractor_ID"];
                    }

                    if (!Reader.IsDBNull(Reader.GetOrdinal("ContractorName")))
                    {
                        item.item_Contractor.Name = (string)Reader["ContractorName"];
                    }

                    if (!Reader.IsDBNull(Reader.GetOrdinal("ContractorShortName")))
                    {
                        item.item_Contractor.Short = (string)Reader["ContractorShortName"];
                    }

                    if (!Reader.IsDBNull(Reader.GetOrdinal("Sort_ID")))
                    {
                        item.item_Sort.ID = (int)Reader["Sort_ID"];
                    }

                    if (!Reader.IsDBNull(Reader.GetOrdinal("SortName")))
                    {
                        item.item_Sort.Name = (string)Reader["SortName"];
                    }

                    if (!Reader.IsDBNull(Reader.GetOrdinal("SortShortName")))
                    {
                        item.item_Sort.Short = (string)Reader["SortShortName"];
                    }

                    if (!Reader.IsDBNull(Reader.GetOrdinal("PurityGroup_ID")))
                    {
                        item.item_PurityGroup.ID = (int)Reader["PurityGroup_ID"];
                    }

                    if (!Reader.IsDBNull(Reader.GetOrdinal("PurityGroupName")))
                    {
                        item.item_PurityGroup.Name = (string)Reader["PurityGroupName"];
                    }

                    if (!Reader.IsDBNull(Reader.GetOrdinal("PurityGroupShortName")))
                    {
                        item.item_PurityGroup.Short = (string)Reader["PurityGroupShortName"];
                    }

                    if (!Reader.IsDBNull(Reader.GetOrdinal("BacterialInsiminateClass_ID")))
                    {
                        item.item_BacterialInsiminateClass.ID = (int)Reader["BacterialInsiminateClass_ID"];
                    }

                    if (!Reader.IsDBNull(Reader.GetOrdinal("BacterialInsiminateClassName")))
                    {
                        item.item_BacterialInsiminateClass.Name = (string)Reader["BacterialInsiminateClassName"];
                    }

                    if (!Reader.IsDBNull(Reader.GetOrdinal("BacterialInsiminateClassShortName")))
                    {
                        item.item_BacterialInsiminateClass.Short = (string)Reader["BacterialInsiminateClassShortName"];
                    }

                    if (!Reader.IsDBNull(Reader.GetOrdinal("Status_ID")))
                    {
                        item.item_Status.ID = (int)Reader["Status_ID"];
                    }

                    if (!Reader.IsDBNull(Reader.GetOrdinal("StatusName")))
                    {
                        item.item_Status.Name = (string)Reader["StatusName"];
                    }

                    if (!Reader.IsDBNull(Reader.GetOrdinal("StatusShortName")))
                    {
                        item.item_Status.Short = (string)Reader["StatusShortName"];
                    }

                    if (!Reader.IsDBNull(Reader.GetOrdinal("RichnessVal")))
                    {
                        item.RichnessVal = (double)Reader["RichnessVal"];
                    }

                    if (!Reader.IsDBNull(Reader.GetOrdinal("MassBaseRichnessVal")))
                    {
                        item.MassBaseRichnessVal = (double)Reader["MassBaseRichnessVal"];
                    }

                    if (!Reader.IsDBNull(Reader.GetOrdinal("AcidityVal")))
                    {
                        item.AcidityVal = (double)Reader["AcidityVal"];
                    }

                    if (!Reader.IsDBNull(Reader.GetOrdinal("TemperatureVal")))
                    {
                        item.TemperatureVal = (double)Reader["TemperatureVal"];
                    }

                    if (!Reader.IsDBNull(Reader.GetOrdinal("DensityVal")))
                    {
                        item.DensityVal = (double)Reader["DensityVal"];
                    }

                    if (!Reader.IsDBNull(Reader.GetOrdinal("MassNetVal")))
                    {
                        item.MassNetVal = (double)Reader["MassNetVal"];
                    }

                    if (!Reader.IsDBNull(Reader.GetOrdinal("VolumeVal")))
                    {
                        item.VolumeVal = (double)Reader["VolumeVal"];
                    }

                    if (!Reader.IsDBNull(Reader.GetOrdinal("MassNetFactVal")))
                    {
                        item.MassNetFactVal = (double)Reader["MassNetFactVal"];
                    }

                    if (!Reader.IsDBNull(Reader.GetOrdinal("Comments")))
                    {
                        item.Comments = (string)Reader["Comments"];
                    }

                    list.Add(item);
                }
                Reader.Close();
                conn.Close();
            }

            return(list);
        }
Esempio n. 6
0
        public cConsignmentEx()
        {
            CNote = new cConsignmentItem();
            list_BacterialInsiminateClass = new List<cListItem>();
            list_Contractor = new List<cListItem>();
            list_PurityGroup = new List<cListItem>();
            list_Sort = new List<cListItem>();
            list_Status = new List<cListItem>();

            //setMode('D');

        }
Esempio n. 7
0
        //------ INSERT UPDATE накладной
        public static int ins_upd_ConsignmentNote(cConsignmentItem C)
        {
            int ret = 0;
            using (SqlConnection conn = new SqlConnection(CommManager.ConnectionString))
            {
                SqlCommand cmd = new SqlCommand("lp_ins_upd_ConsignmentNote");
                conn.Open();
                cmd.Connection = conn;
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@ConsignmentNoteID", objectOrNull(C.ID));
                cmd.Parameters.AddWithValue("@DT_In", objectOrNull(C.DT_In));
                cmd.Parameters.AddWithValue("@DT_Out", objectOrNull(C.DT_Out));
                cmd.Parameters.AddWithValue("@ConsignmentNote_N", C.ConsigmentNote_N);
                cmd.Parameters.AddWithValue("@Contractor_ID", objectOrNull(C.item_Contractor.ID));
                cmd.Parameters.AddWithValue("@Sort_ID", objectOrNull(C.item_Sort.ID));
                cmd.Parameters.AddWithValue("@PurityGroup_ID", objectOrNull(C.item_PurityGroup.ID));
                cmd.Parameters.AddWithValue("@BacterialInsiminateClass_ID", objectOrNull(C.item_BacterialInsiminateClass.ID));
                cmd.Parameters.AddWithValue("@Status_ID", objectOrNull(C.item_Status.ID));

                cmd.Parameters.AddWithValue("@RichnessVal", objectOrNull(C.RichnessVal));
                cmd.Parameters.AddWithValue("@MassBaseRichnessVal", objectOrNull(C.MassBaseRichnessVal));
                cmd.Parameters.AddWithValue("@AcidityVal", objectOrNull(C.AcidityVal));
                cmd.Parameters.AddWithValue("@TemperatureVal", objectOrNull(C.TemperatureVal));
                cmd.Parameters.AddWithValue("@DensityVal", objectOrNull(C.DensityVal));
                cmd.Parameters.AddWithValue("@ProteinVal", objectOrNull(C.ProteinVal));

                cmd.Parameters.AddWithValue("@Comments", objectOrNull(C.Comments));
                cmd.Parameters.AddWithValue("@VolumeVal", objectOrNull(C.VolumeVal));
                cmd.Parameters.AddWithValue("@MassNetFactVal", objectOrNull(C.MassNetVal));


                //cmd.Parameters.Add("@rowcount_out", SqlDbType.Int);
                //cmd.Parameters["@rowcount_out"].Direction = ParameterDirection.Output;

                cmd.ExecuteNonQuery();
                ret = 1;

                //ret = (int)cmd.Parameters["@rowcount_out"].Value;

                conn.Close();
            }
            return ret;
        }
Esempio n. 8
0
        //----- SELECT списка накладных или одной накладной ------------------------------
        public static List<cConsignmentItem> sel_ConsignmentNote(cFilterList filter)
        {
            List<cConsignmentItem> list = new List<cConsignmentItem>();
            using (SqlConnection conn = new SqlConnection(CommManager.ConnectionString))
            {
                SqlCommand cmd = new SqlCommand("lp_sel_ConsignmentNote");
                conn.Open();
                cmd.Connection = conn;
                cmd.CommandType = CommandType.StoredProcedure;
                
                    // @ConsignmentNoteID int = null
                    // @BeginDT smalldatetime = null
                    // @EndDT	smalldatetime = null
                    // @StatusID int = null

                cmd.Parameters.AddWithValue("@ConsignmentNoteID", objectOrNull(filter.ConsignmentNoteID));
                cmd.Parameters.AddWithValue("@BeginDT", objectOrNull(filter.BeginDT));
                cmd.Parameters.AddWithValue("@EndDT", objectOrNull(filter.EndDT));
                cmd.Parameters.AddWithValue("@StatusID", objectOrNull(filter.StatusIDString));

                SqlDataReader Reader = cmd.ExecuteReader();

                while (Reader.Read())
                {
                    cConsignmentItem item = new cConsignmentItem();

                    if (!Reader.IsDBNull(Reader.GetOrdinal("ID")))
                        item.ID = (int)Reader["ID"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("DT_In")))
                        item.DT_In = (DateTime)Reader["DT_In"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("DT_Out")))
                        item.DT_Out = (DateTime)Reader["DT_Out"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("ConsignmentNote_N")))
                        item.ConsigmentNote_N = (string)Reader["ConsignmentNote_N"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("Contractor_ID")))
                        item.item_Contractor.ID = (int)Reader["Contractor_ID"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("ContractorName")))
                        item.item_Contractor.Name = (string)Reader["ContractorName"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("ContractorShortName")))
                        item.item_Contractor.Short = (string)Reader["ContractorShortName"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("Sort_ID")))
                        item.item_Sort.ID = (int)Reader["Sort_ID"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("SortName")))
                        item.item_Sort.Name = (string)Reader["SortName"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("SortShortName")))
                        item.item_Sort.Short = (string)Reader["SortShortName"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("PurityGroup_ID")))
                        item.item_PurityGroup.ID = (int)Reader["PurityGroup_ID"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("PurityGroupName")))
                        item.item_PurityGroup.Name = (string)Reader["PurityGroupName"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("PurityGroupShortName")))
                        item.item_PurityGroup.Short = (string)Reader["PurityGroupShortName"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("BacterialInsiminateClass_ID")))
                        item.item_BacterialInsiminateClass.ID = (int)Reader["BacterialInsiminateClass_ID"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("BacterialInsiminateClassName")))
                        item.item_BacterialInsiminateClass.Name = (string)Reader["BacterialInsiminateClassName"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("BacterialInsiminateClassShortName")))
                        item.item_BacterialInsiminateClass.Short = (string)Reader["BacterialInsiminateClassShortName"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("Status_ID")))
                        item.item_Status.ID = (int)Reader["Status_ID"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("StatusName")))
                        item.item_Status.Name = (string)Reader["StatusName"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("StatusShortName")))
                        item.item_Status.Short = (string)Reader["StatusShortName"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("RichnessVal")))
                        item.RichnessVal = (double)Reader["RichnessVal"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("MassBaseRichnessVal")))
                        item.MassBaseRichnessVal = (double)Reader["MassBaseRichnessVal"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("AcidityVal")))
                        item.AcidityVal = (double)Reader["AcidityVal"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("TemperatureVal")))
                        item.TemperatureVal = (double)Reader["TemperatureVal"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("DensityVal")))
                        item.DensityVal = (double)Reader["DensityVal"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("MassNetVal")))
                        item.MassNetVal = (double)Reader["MassNetVal"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("VolumeVal")))
                        item.VolumeVal = (double)Reader["VolumeVal"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("MassNetFactVal")))
                        item.MassNetFactVal = (double)Reader["MassNetFactVal"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("Comments")))
                        item.Comments = (string)Reader["Comments"];

                    list.Add(item);
                }
                Reader.Close();
                conn.Close();
            }

            return list;
        }