コード例 #1
0
        public static List <IATaskApproval> GetDdlUserApproval(string strUserDepart)
        {
            List <IATaskApproval> listIAUserApproval = new List <IATaskApproval>();
            SqlConnection         con    = new SqlConnection(ConString);
            SqlCommand            cmd    = new SqlCommand("usp_GetUserApproval", con);
            SqlDataReader         reader = null;

            AddInParameter(cmd, "@UserApproval", strUserDepart);
            try
            {
                cmd.CommandType = CommandType.StoredProcedure;
                con.Open();
                reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    IATaskApproval iaDDLUserApproval = new IATaskApproval();
                    if (reader["UserID"] != DBNull.Value)
                    {
                        iaDDLUserApproval.IdTaskApproval = (int)reader["UserID"];
                    }
                    if (reader["UserName"] != DBNull.Value)
                    {
                        iaDDLUserApproval.NameApprovalTask = reader["UserName"].ToString();
                    }
                    listIAUserApproval.Add(iaDDLUserApproval);
                }
            }
            catch (Exception e)
            {
                AppLogger.LogError(e);
            }
            finally
            {
                reader.Close();
                reader.Dispose();
                con.Close();
                con.Dispose();
            }

            return(listIAUserApproval);
        }
コード例 #2
0
        public int SaveData(string strConSQL, string strSP, IAHeaders header, DataTable dtModel, DataTable dtPart, DataTable dtDepartment, DataTable dtDepartmentDetail)
        {
            int           result = (int)SaveStatus.Initial;
            SqlConnection con    = new SqlConnection(ConString);
            SqlCommand    cmd    = new SqlCommand(strSP, con);

            AddInParameter(cmd, "@IAid", header.IAId);
            AddInParameter(cmd, "@IAType", header.IAType);
            AddInParameter(cmd, "@InternalEpcNumber", header.InternalEpcNumber);
            AddInParameter(cmd, "@InfoNumber", header.InfoNumber);
            AddInParameter(cmd, "@InfoFrom", header.InfoFrom);
            AddInParameter(cmd, "@Description", header.Description);
            AddInParameter(cmd, "@ValidPeriodFrom", header.ValidPeriodFrom);
            AddInParameter(cmd, "@ValidPeriodTo", header.ValidPeriodTo);
            AddInParameter(cmd, "@ImplementationDate", header.ImplementationDate == DateTime.MinValue ? null : header.ImplementationDate);
            AddInParameter(cmd, "@DynamicCheck", header.DynamicCheck);
            AddInParameter(cmd, "@AuthorUserId", header.AuthorUserId);
            AddInParameter(cmd, "@StatusID", header.StatusID);
            AddInParameter(cmd, "@TvpIAModel", dtModel);
            AddInParameter(cmd, "@TvpIAPart", dtPart);
            AddInParameter(cmd, "@TvpIADepartment", dtDepartment);
            AddInParameter(cmd, "@TvpIADepartmentDetail", dtDepartmentDetail);
            try
            {
                cmd.CommandType = CommandType.StoredProcedure;
                con.Open();
                cmd.ExecuteNonQuery();
                result = (int)SaveStatus.Success;
            }
            catch (Exception e)
            {
                result = (int)SaveStatus.Error;
                AppLogger.LogError(e);
            }
            finally
            {
                con.Close();
                con.Dispose();
            }

            return(result);
        }
コード例 #3
0
        protected void Btn_Edit_Click(object sender, EventArgs e)
        {
            pcInteruptFault.ShowOnPageLoad = true;
            ASPxButton btn = sender as ASPxButton;
            GridViewDataItemTemplateContainer container = btn.NamingContainer as GridViewDataItemTemplateContainer;
            var index = container.VisibleIndex;

            try
            {
                int ValueId = gridFault.GetRowValues(index, "FaultRecordId") == null ? 0 : int.Parse(gridFault.GetRowValues(index, "FaultRecordId").ToString());
                if (ValueId != 0)
                {
                    loadFaultDefaultEdit(ValueId);
                }
            }
            catch (Exception ex)
            {
                AppLogger.LogError(ex);
            }
        }
コード例 #4
0
        public static List <IAStatusTask> GetDdlStatus()
        {
            List <IAStatusTask> listIAStatustask = new List <IAStatusTask>();
            SqlConnection       con    = new SqlConnection(ConString);
            SqlCommand          cmd    = new SqlCommand("usp_GetStatusApproval", con);
            SqlDataReader       reader = null;

            try
            {
                cmd.CommandType = CommandType.StoredProcedure;
                con.Open();
                reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    IAStatusTask iaDDLStatustask = new IAStatusTask();
                    if (reader["Id"] != DBNull.Value)
                    {
                        iaDDLStatustask.IdStatusTask = (int)reader["Id"];
                    }
                    if (reader["StatusTask"] != DBNull.Value)
                    {
                        iaDDLStatustask.StatusTask = reader["StatusTask"].ToString();
                    }
                    listIAStatustask.Add(iaDDLStatustask);
                }
            }
            catch (Exception e)
            {
                AppLogger.LogError(e);
            }
            finally
            {
                reader.Close();
                reader.Dispose();
                con.Close();
                con.Dispose();
            }

            return(listIAStatustask);
        }
コード例 #5
0
        public static List <IATaskDepartment> GetDdlDepartment()
        {
            List <IATaskDepartment> listIADepartment = new List <IATaskDepartment>();
            SqlConnection           con = new SqlConnection(ConString);
            SqlCommand    cmd           = new SqlCommand("usp_GetDepartment", con);
            SqlDataReader reader        = null;

            try
            {
                cmd.CommandType = CommandType.StoredProcedure;
                con.Open();
                reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    IATaskDepartment iaDDLTaskDepartment = new IATaskDepartment();
                    if (reader["Id"] != DBNull.Value)
                    {
                        iaDDLTaskDepartment.IdTaskDepartment = (int)reader["Id"];
                    }
                    if (reader["Name"] != DBNull.Value)
                    {
                        iaDDLTaskDepartment.NameTaskDepartment = reader["Name"].ToString();
                    }
                    listIADepartment.Add(iaDDLTaskDepartment);
                }
            }
            catch (Exception e)
            {
                AppLogger.LogError(e);
            }
            finally
            {
                reader.Close();
                reader.Dispose();
                con.Close();
                con.Dispose();
            }

            return(listIADepartment);
        }
コード例 #6
0
        public List <Usuario> Usuario_Iniciar_Sesion(string usuario, string clave)
        {
            List <Usuario> UsuarioLeer = new List <Usuario>();

            try
            {
                SqlCommand cmd = new SqlCommand();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "SP_Usuario_Iniciar_Sesion";
                cmd.Connection  = cn.cn;
                cn.Conectar();
                cmd.Parameters.Add(new SqlParameter("@Usuario", SqlDbType.Text)).Value = usuario;
                cmd.Parameters.Add(new SqlParameter("@Clave", SqlDbType.Text)).Value   = clave;
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                DataTable      dt = new DataTable();
                da.Fill(dt);


                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    Usuario datosusuario = new Usuario();
                    datosusuario.IdUsuario         = Funciones.ToString(dt.Rows[i]["IDUsuario"]);
                    datosusuario.NombreUsuario     = Funciones.ToString(dt.Rows[i]["NombreUsuario"]);
                    datosusuario.ApellidoUsuario   = Funciones.ToString(dt.Rows[i]["ApellidoUsuario"]);
                    datosusuario.EstadoUsuario     = Funciones.ToString(dt.Rows[i]["EstadoUsuario"]);
                    datosusuario.EstadoUsuarioDesc = Funciones.ToString(dt.Rows[i]["EstadoUsuarioDesc"]);
                    datosusuario.CreadoPor         = Funciones.ToString(dt.Rows[i]["CreadoPor"]);
                    datosusuario.FechaCreacion     = Funciones.ToDateTime(dt.Rows[i]["FechaCreacion"]);
                    datosusuario.ModificadoPor     = Funciones.ToString(dt.Rows[i]["ModificadoPor"]);
                    datosusuario.FechaModificacion = Funciones.ToDateTime(dt.Rows[i]["FechaModificacion"]);
                    UsuarioLeer.Add(datosusuario);
                }
                cn.Desconectar();
            }
            catch (Exception ex)
            {
                AppLogger.LogError("Error : Usuario_Iniciar_Sesion (Datos)", ex);;
            }

            return(UsuarioLeer);
        }
コード例 #7
0
        public static List <IAModel> GetDDLIAModels(string strSP)
        {
            List <IAModel> listIAModelDDL = new List <IAModel>();
            SqlConnection  con            = new SqlConnection(ConString);
            SqlCommand     cmd            = new SqlCommand(strSP, con);
            SqlDataReader  reader         = null;

            try
            {
                cmd.CommandType = CommandType.StoredProcedure;
                con.Open();
                reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    IAModel iaModelDDL = new IAModel();
                    if (reader["Id"] != DBNull.Value)
                    {
                        iaModelDDL.IDModel = (int)reader["Id"];
                    }
                    if (reader["ModelName"] != DBNull.Value)
                    {
                        iaModelDDL.ModelName = reader["ModelName"].ToString();
                    }
                    listIAModelDDL.Add(iaModelDDL);
                }
            }
            catch (Exception e)
            {
                AppLogger.LogError(e);
            }
            finally
            {
                reader.Close();
                reader.Dispose();
                con.Close();
                con.Dispose();
            }

            return(listIAModelDDL);
        }
コード例 #8
0
        public static bool SaveCgisImage(int cpDetail1Id, byte[] imgCgisWithAnnot)
        {
            try
            {
                using (AppDb context = new AppDb())
                {
                    ControlPlanImage cpi = new ControlPlanImage();
                    cpi.ControlPlanProcessId = cpDetail1Id;
                    cpi.Image = imgCgisWithAnnot;

                    context.ControlPlanImages.Add(cpi);
                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                AppLogger.LogError(ex);
                return(false);
            }
            return(true);
        }
コード例 #9
0
        protected void btnSend_OnClick(object sender, EventArgs e)
        {
            try
            {
                ASPxButton btn = (sender as ASPxButton);
                int        i   = Convert.ToInt32(btn.CommandArgument);

                if (i != 0 || i != null)
                {
                    string query = @"UPDATE VPCStorage SET SendToMarketing = GETDATE() WHERE Id=" + Convert.ToString(i);

                    AppDb   context = new AppDb();
                    DataSet dsData  = new DataSet();

                    using (SqlConnection conn = new SqlConnection(context.Database.Connection.ConnectionString))
                    {
                        if (conn.State == ConnectionState.Closed)
                        {
                            conn.Open();
                        }

                        using (SqlCommand cmd = new SqlCommand())
                        {
                            cmd.CommandText    = query;
                            cmd.CommandTimeout = 7000;
                            cmd.CommandType    = CommandType.Text;
                            cmd.Connection     = conn;
                            cmd.ExecuteNonQuery();
                        }
                    }
                    LoadData();
                    //Response.Redirect(Request.RawUrl);
                }
            }
            catch (Exception ex)
            {
                AppLogger.LogError(ex);
            }
        }
コード例 #10
0
        protected override void AddFields(Item item, Document document)
        {
            if (IsItemIndexable(item))
            {
                base.AddFields(item, document);

                _customFields = new List <Field>();
                try
                {
                    CreateCustomIndexFields(item);
                }
                catch (Exception ex)
                {
                    AppLogger.LogError(string.Format("Failed to create custom index fields for item {0}.", item.Paths.Path), ex);
                }

                foreach (Field customField in _customFields)
                {
                    document.Add(customField);
                }
            }
        }
コード例 #11
0
        protected void btnBPK_OnClick(object sender, EventArgs e)
        {
            try
            {
                LoadData();

                //int id = Convert.ToInt32(btn.CommandArgument);
                ASPxButton btn = sender as ASPxButton;
                GridViewDataItemTemplateContainer container = btn.NamingContainer as GridViewDataItemTemplateContainer;
                var Rowindex = container.VisibleIndex;
                //int id = int.Parse(grid.GetRowValues(Rowindex, "FINNumber").ToString());
                string Id = grid.GetRowValues(Rowindex, "Id").ToString();
                if (Id != null)
                {
                    string user = ((User)Session["user"]).UserName;

                    //Update data date and user already confirm
                    string query = @"UPDATE VPCStorage SET BPK = GETDATE(), BPKBy ='" + user + "'  WHERE Id=" + Id;
                    using (SqlConnection conn = AppConnection.GetConnection())
                    {
                        if (conn.State == ConnectionState.Closed)
                        {
                            conn.Open();
                        }

                        using (SqlCommand cmd = new SqlCommand())
                        {
                            cmd.CommandText    = query;
                            cmd.CommandTimeout = 7000;
                            cmd.CommandType    = CommandType.Text;
                            cmd.Connection     = conn;
                            cmd.ExecuteNonQuery();
                        }
                    }

                    // SAP
                    DataTable dt = GetOrderNoVPCStorage(Id.ToInt32(0));

                    //DataTable GrInfo
                    if (dt.Rows.Count > 0)
                    {
                        DataRow dr = dt.Rows[0];
                        //dtBPK = Convert.ToDateTime(dr["BPK"]);
                        string tOrderNo = dr["OrderNo"].ToString();

                        DataTable GrInfoDt = new DataTable();
                        using (var con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["AppDb"].ConnectionString))
                            using (var cmd = new SqlCommand("usp_GetGRInfoToSAPbyProdOrder", con))
                                using (var da = new SqlDataAdapter(cmd))
                                {
                                    cmd.CommandType = CommandType.StoredProcedure;
                                    cmd.Parameters.Add(new SqlParameter("@OrderNo", tOrderNo));
                                    da.Fill(GrInfoDt);
                                }

                        if (dr["BuyOutDate"] != DBNull.Value)
                        {
                            string            tSAPMessage   = "";
                            string            tSAPMessageGR = "";
                            Ebiz.SAP.UserUtil SendToSAP     = new Ebiz.SAP.UserUtil();

                            bool resultFromSAP = SendToSAP.ConfirmOrderPKW(SAPConfiguration.SAP_CONFIG_NAME, tOrderNo, "TIDS", "0010", out tSAPMessage);

                            System.Threading.Thread.Sleep(2000);
                            DataTable resultFromSAPGR = SendToSAP.GoodReceiptAutomatically(SAPConfiguration.SAP_CONFIG_NAME, tOrderNo, out tSAPMessageGR);

                            if (resultFromSAP == true && string.IsNullOrEmpty(tSAPMessageGR))
                            {
                                SendToSAP.UpdateVDC(SAPConfiguration.SAP_CONFIG_NAME, tOrderNo, GrInfoDt);
                                ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage", @"alert('Check SAP Order Number data successfully');", true);
                            }
                            else
                            {
                                if (!string.IsNullOrEmpty(tSAPMessageGR))
                                {
                                    ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage", @"alert('Error: " + tSAPMessageGR + "');", true);
                                }
                                else
                                {
                                    ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage", @"alert('Check SAP Order Number:" + tSAPMessage + "');", true);
                                }
                            }
                        }

                        //string tSAPMessage = "";
                        //string tSAPMessageGR = "";
                        //Ebiz.SAP.UserUtil SendToSAP = new Ebiz.SAP.UserUtil();

                        //bool resultFromSAP = SendToSAP.ConfirmOrderPKW(SAPConfiguration.SAP_CONFIG_NAME, tOrderNo, "TIDS", "0010", out tSAPMessage);
                        //if (resultFromSAP == true)
                        //{
                        //    //Update data date and user already confirm
                        //    string query = @"UPDATE VPCStorage SET BPK = GETDATE() WHERE Id=" + Id;
                        //    using (SqlConnection conn = AppConnection.GetConnection())
                        //    {
                        //        if (conn.State == ConnectionState.Closed) conn.Open();

                        //        using (SqlCommand cmd = new SqlCommand())
                        //        {
                        //            cmd.CommandText = query;
                        //            cmd.CommandTimeout = 7000;
                        //            cmd.CommandType = CommandType.Text;
                        //            cmd.Connection = conn;
                        //            cmd.ExecuteNonQuery();
                        //        }
                        //    }

                        //    string user = ((User)Session["user"]).UserName;
                        //    SqlDataSource1.UpdateCommand = "UPDATE VPCStorage SET BPKBy ='" + user + "' WHERE Id =" + Id;
                        //    SqlDataSource1.Update();

                        //    if (dr["BuyOutDate"] == DBNull.Value)
                        //    {
                        //        ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage", @"alert('Confirm BPK is successful');", true);
                        //    }
                        //    else
                        //    {
                        //        System.Threading.Thread.Sleep(2000);
                        //        DataTable resultFromSAPGR = SendToSAP.GoodReceiptAutomatically(SAPConfiguration.SAP_CONFIG_NAME, tOrderNo, out tSAPMessageGR);

                        //        if (string.IsNullOrEmpty(tSAPMessageGR))
                        //        {
                        //            SendToSAP.UpdateVDC(SAPConfiguration.SAP_CONFIG_NAME, tOrderNo, GrInfoDt);

                        //            //Update data date and user already confirm
                        //            query = @"UPDATE VPCStorage SET GRDATE = GETDATE() WHERE Id=" + Id;
                        //            using (SqlConnection conn = AppConnection.GetConnection())
                        //            {
                        //                if (conn.State == ConnectionState.Closed) conn.Open();

                        //                using (SqlCommand cmd = new SqlCommand())
                        //                {
                        //                    cmd.CommandText = query;
                        //                    cmd.CommandTimeout = 7000;
                        //                    cmd.CommandType = CommandType.Text;
                        //                    cmd.Connection = conn;
                        //                    cmd.ExecuteNonQuery();
                        //                }
                        //            }
                        //            ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage", @"alert('Confirm BPK and SAP GR is successful');", true);

                        //        }
                        //        else
                        //        {
                        //            if (!string.IsNullOrEmpty(tSAPMessageGR))
                        //                ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage", @"alert('Error: " + tSAPMessageGR + "');", true);
                        //            else
                        //                ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage", @"alert('SAP GR failed:" + tSAPMessage + "');", true);
                        //        }
                        //    }   //if (dr["BuyOutDate"] != DBNull.Value)
                        //}
                        //else
                        //{
                        //    ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage", @"alert('Confirm BPK failed:" + tSAPMessage + "');", true);
                        //}
                    }

                    //Response.Redirect(Request.RawUrl);
                    LoadData();
                }
            }
            catch (Exception ex)
            {
                AppLogger.LogError(ex);
            }
        }
コード例 #12
0
        public async Task <HttpResponseMessage> Import(RssImportModel model)
        {
            var response = new HttpResponseMessage(HttpStatusCode.OK);

            _model = model;

            if (model == null || string.IsNullOrEmpty(model.FeedUrl))
            {
                response.StatusCode   = HttpStatusCode.NotFound;
                response.ReasonPhrase = "RSS feed URL is required";
                return(response);
            }

            var blog = _db.Profiles.Single(b => b.Id == model.ProfileId);

            if (blog == null)
            {
                response.StatusCode   = HttpStatusCode.NotFound;
                response.ReasonPhrase = Constants.ProfileNotFound;
                return(response);
            }

            try
            {
                var storage = new BlogStorage(blog.Slug);
                var items   = GetFeedItems(model.FeedUrl);

                _logger.LogInformation(string.Format("Start importing {0} posts", items.Count));

                foreach (var item in items)
                {
                    var content = item.Body.Length > item.Description.Length ? item.Body : item.Description;

                    var desc = content.StripHtml();
                    if (desc.Length > 300)
                    {
                        desc = desc.Substring(0, 300);
                    }

                    var post = new BlogPost
                    {
                        ProfileId   = model.ProfileId,
                        Title       = item.Title,
                        Slug        = item.Title.ToSlug(),
                        Description = desc,
                        Content     = content,
                        Published   = item.PublishDate
                    };
                    if (model.ImportImages)
                    {
                        await ImportImages(post, storage);
                    }
                    if (model.ImportAttachements)
                    {
                        await ImportAttachements(post, storage);
                    }
                    _db.BlogPosts.Add(post);
                    _db.Complete();
                    _logger.LogInformation(string.Format("RSS item added : {0}", item.Title));

                    await AddCategories(item, model.ProfileId);
                }
                response.ReasonPhrase = string.Format("Imported {0} blog posts", items.Count);
                return(response);
            }
            catch (Exception ex)
            {
                _logger.LogError(string.Format("Error importing RSS : {0}", ex.Message));

                response.StatusCode   = HttpStatusCode.BadRequest;
                response.ReasonPhrase = ex.Message;
                return(response);
            }
        }
コード例 #13
0
        protected void grid_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e)
        {
            try
            {
                ASPxGridView grv = (sender as ASPxGridView);
                if (e.VisibleIndex > -1)
                {
                    if (e.DataColumn.FieldName == "SendToMarketing")
                    {
                        DataRowView row = grv.GetRow(e.VisibleIndex) as DataRowView;
                        string      bpk = row["BPK"].ToString();

                        ASPxButton btnSend = grv.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "btnSend") as ASPxButton;
                        ASPxLabel  lblSend = grv.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lblSend") as ASPxLabel;

                        string caption = e.CellValue.ToString();// Convert.ToString(e.CellValue);
                        if (caption == string.Empty && !string.IsNullOrEmpty(bpk))
                        {
                            btnSend.Visible = true;
                            lblSend.Visible = false;
                        }
                        else
                        {
                            lblSend.Text    = caption;
                            btnSend.Visible = false;
                            lblSend.Visible = true;
                        }
                    }

                    if (e.DataColumn.FieldName == "PrintNik")
                    {
                        ASPxButton btnPrintNik = grv.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "btnPrintNIK") as ASPxButton;
                        ASPxLabel  lblPrintNik = grv.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lblPrintNIK") as ASPxLabel;
                        string     caption     = e.CellValue.ToString("yyyy-MM-dd");// Convert.ToString(e.CellValue);
                        if (caption != string.Empty)
                        {
                            lblPrintNik.Text    = caption;
                            btnPrintNik.Visible = false;
                            lblPrintNik.Visible = true;
                        }
                        else
                        {
                            btnPrintNik.Visible = false;
                            lblPrintNik.Visible = false;
                        }
                    }

                    if (e.DataColumn.FieldName == "ReceivedByMarketing")
                    {
                        ASPxButton btnRCV = grv.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "btnRCV") as ASPxButton;
                        ASPxLabel  lblRCV = grv.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lblRCV") as ASPxLabel;

                        string caption = e.CellValue.ToString();// Convert.ToString(e.CellValue);
                        if (caption != string.Empty)
                        {
                            lblRCV.Text    = caption;
                            btnRCV.Visible = false;
                            lblRCV.Visible = true;
                        }
                        else
                        {
                            btnRCV.Visible = false;
                            lblRCV.Visible = false;
                        }
                    }

                    if (e.DataColumn.FieldName == "BPK")
                    {
                        ASPxButton btnBPK = grv.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "btnBPK") as ASPxButton;
                        ASPxLabel  lblBPK = grv.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lblBPK") as ASPxLabel;

                        string caption = e.CellValue.ToString();// Convert.ToString(e.CellValue);
                        if (caption != string.Empty)
                        {
                            lblBPK.Text    = caption;
                            btnBPK.Visible = false;
                            lblBPK.Visible = true;
                        }
                        else
                        {
                            btnBPK.Visible = false;
                            lblBPK.Visible = false;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                AppLogger.LogError(ex);
            }
        }
コード例 #14
0
        protected void DetailChangedTes(object sender, ASPxGridViewDetailRowEventArgs e)
        {
            try
            {
                ASPxGridView some    = (ASPxGridView)sender;
                var          colapse = some.DetailRows.VisibleCount;
                if (colapse == 1)
                {
                    IList <ToolVerification> result = new List <ToolVerification>();
                    var rowIndex = e.VisibleIndex;

                    // var ValueId = GridviewToolVerification.GetRowValues(i, "ToolSetupId");
                    var ValueId        = GridviewToolVerification.GetRowValues(rowIndex, "ToolId");
                    var ValueInventory = GridviewToolVerification.GetRowValues(rowIndex, "Id");
                    Session["VisibleIndex"] = ValueInventory.ToString();
                    var      NextDayGet               = GridviewToolVerification.GetRowValues(rowIndex, "NextDay");
                    var      ToolNumber               = GridviewToolVerification.GetRowValues(rowIndex, "ToolNumber");
                    DateTime today                    = DateTime.Now;
                    var      MinNMGet                 = GridviewToolVerification.GetRowValues(rowIndex, "MinNM");
                    var      MaxNMGet                 = GridviewToolVerification.GetRowValues(rowIndex, "MaxNM");
                    var      ValSetNm                 = GridviewToolVerification.GetRowValues(rowIndex, "SetNM");
                    var      ValueToolSetupId         = GridviewToolVerification.GetRowValues(rowIndex, "Id");
                    var      ValueNextCalibrationDate = GridviewToolVerification.GetRowValues(rowIndex, "NextCalibrationDate");
                    var      CheckValue               = ValueNextCalibrationDate.ToString() == "" ? 0 : 1;
                    HiddenCheckValue.Value = CheckValue.ToString();

                    var x = GridviewToolVerification.FindDetailRowTemplateControl(rowIndex, "LayoutDetails") as ASPxFormLayout;

                    var GetDataCalibrationDate = x.FindControl("lblCalibrationDate") as ASPxLabel;
                    GetDataCalibrationDate.Text = ValueNextCalibrationDate.ToString() == "" ? (DateTime.Now).ToString() : ValueNextCalibrationDate.ToString();
                    var GetNextDay = x.FindControl("DateDetails") as ASPxTextBox;
                    GetNextDay.Text = NextDayGet.ToString() == "" ? "0" : NextDayGet.ToString();
                    //DateTime today = DateTime.Now;
                    var GetNextDate = x.FindControl("DateDetailsCalender") as ASPxTextBox;
                    GetNextDate.Text = (today.AddDays(int.Parse(NextDayGet.ToString() == "" ? "0" : NextDayGet.ToString()))).ToString();

                    var GetDataInventoryNumber = x.FindControl("lblInventoryNumber") as ASPxLabel;
                    GetDataInventoryNumber.Text = ToolNumber.ToString();
                    var GetDataNmRange = x.FindControl("lblNmRange") as ASPxLabel;
                    GetDataNmRange.Text = MinNMGet.ToString() + '-' + MaxNMGet.ToString() + " Nm";
                    var ButtonMarks = x.FindControl("Btn_mark") as ASPxButton;
                    var BtnSave     = x.FindControl("BtnSave") as ASPxButton;

                    var Btn_Verify = x.FindControl("Btn_Verify") as ASPxButton;

                    var lbl20 = x.FindControl("lbl20") as ASPxLabel;
                    lbl20.Text = "20% (" + Convert.ToDouble(MaxNMGet) * 0.2 + " Nm)";
                    var lbl40 = x.FindControl("lbl40") as ASPxLabel;
                    lbl40.Text = "40% (" + Convert.ToDouble(MaxNMGet) * 0.4 + " Nm)";
                    var lbl60 = x.FindControl("lbl60") as ASPxLabel;
                    lbl60.Text = "60% (" + Convert.ToDouble(MaxNMGet) * 0.6 + " Nm)";
                    var lbl80 = x.FindControl("lbl80") as ASPxLabel;
                    lbl80.Text = "80% (" + Convert.ToDouble(MaxNMGet) * 0.8 + " Nm)";
                    var lbl100 = x.FindControl("lbl100") as ASPxLabel;
                    lbl100.Text = "100% (" + Convert.ToDouble(MaxNMGet) * 1 + " Nm)";
                }
            }
            catch (Exception ex)
            {
                AppLogger.LogError(ex);
            }
        }
コード例 #15
0
        public static bool CreateNewControlPlan(int packingMonth, int modelId, int variantId)
        {
            using (AppDb context = new AppDb())
            {
                context.Database.CommandTimeout = 360; //in second
                using (DbContextTransaction transaction = context.Database.BeginTransaction())
                {
                    try
                    {
                        ControlPlan cpHeader = new ControlPlan();
                        cpHeader.PackingMonth = packingMonth.ToString();
                        cpHeader.ModelId      = modelId;
                        cpHeader.VariantId    = variantId;

                        context.ControlPlans.Add(cpHeader);
                        context.SaveChanges();
                        ////save ke CPHeader
                        //CPHeader cpHeader = new CPHeader();
                        //cpHeader.PackingMonthId = packingMonth;
                        //cpHeader.ModelId = modelId;
                        //cpHeader.VariantId = variantId;

                        //context.CpHeaders.Add(cpHeader);

                        //try
                        //{
                        //    context.SaveChanges();
                        //}
                        //catch (DbEntityValidationException e)
                        //{
                        //    foreach (var eve in e.EntityValidationErrors)
                        //    {
                        //        AppLogger.LogError(@"Entity of type '" + eve.Entry.Entity.GetType().Name + "' in state '" +
                        //                           eve.Entry.State + "' has the following validation errors:");

                        //        foreach (var ve in eve.ValidationErrors)
                        //        {
                        //            AppLogger.LogError(string.Format("- Property: \"{0}\", Error: \"{1}\"",
                        //                ve.PropertyName, ve.ErrorMessage));
                        //        }
                        //    }
                        //    throw;
                        //}

                        ////save to CPDetail
                        //context.Database.ExecuteSqlCommand("usp_CreateControlPlanDetail @vpm, @model, @variant, @createdBy",
                        //    new SqlParameter("@vpm", packingMonth), new SqlParameter("@model", modelId),
                        //    new SqlParameter("@variant", variantId), new SqlParameter("@createdBy", ""));

                        ////save ke Consumption material
                        //context.Database.ExecuteSqlCommand("usp_CreateConsumptionMaterial @vpm, @model",
                        //    new SqlParameter("@vpm", packingMonth), new SqlParameter("@model", modelId));

                        ////save ke ToolList
                        //context.Database.ExecuteSqlCommand("usp_CreateControlPlanToolList @vpm, @model",
                        //    new SqlParameter("@vpm", packingMonth), new SqlParameter("@model", modelId));

                        transaction.Commit();
                        return(true);
                    }
                    catch (Exception ex)
                    {
                        AppLogger.LogError(ex);
                        transaction.Rollback();
                    }
                }
            }
            return(false);
        }
コード例 #16
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="commmandName"></param>
        /// <param name="Parameters"></param>
        /// <returns></returns>
        public async Task <object> RenderViewData(int siteId, int viewId, Dictionary <string, object> parameters)
        {
            var    isGlobalData   = parameters["@Global"];
            var    isFrequentData = parameters["@Frequent"];
            var    isEncryptData  = parameters["@IsEncrypt"];
            string commmandName   = "Sp_RenderView";

            Dictionary <string, object> commandParameters = new Dictionary <string, object>();

            commandParameters.Add("@SiteId", siteId);
            commandParameters.Add("@ViewId", viewId);

            using (DataSet dataSet = await SqlServer.ExecuteDataAsync(commmandName, commandParameters, CommandType.StoredProcedure))
            {
                Dictionary <string, object> obje = new Dictionary <string, object>();

                if (Convert.ToString(isGlobalData) == "1")
                {
                    if (dataSet.Tables.Count > 0 && dataSet.Tables[0].Rows.Count > 0)
                    {
                        var dataRow = dataSet.Tables[0].Rows[0];
                        obje.Add("g", new Global(dataSet.Tables[1])
                        {
                            Oid      = CommonClass.GetRowData <int>(dataRow["Id"]),
                            Name     = CommonClass.GetRowData <string>(dataRow["Name"]),
                            URL      = CommonClass.GetRowData <string>(dataRow["url"]),
                            Logo     = CommonClass.GetRowData <byte[]>(dataRow["Logo"]),
                            Title    = CommonClass.GetRowData <string>(dataRow["Title"]),
                            IsActive = CommonClass.GetRowData <bool>(dataRow["IsActive"])
                        });
                    }
                }

                if (Convert.ToString(isFrequentData) == "1")
                {
                    //if (dataSet.Tables.Count > 1)
                    //    obje.Add("f", dataSet.Tables[1]);
                }

                if (dataSet.Tables.Count > 2)
                {
                    obje.Add("s", dataSet.Tables[2].AsEnumerable().Select(dataRow => new Specific(dataSet.Tables[3])
                    {
                        Oid         = CommonClass.GetRowData <int>(dataRow["Id"]),
                        Orientation = CommonClass.GetRowData <string>(dataRow["Orientation"])
                    }).ToList());
                }

                try
                {
                    if (Convert.ToString(isEncryptData) == "1")
                    {
                        var JsonResult = JsonConvert.SerializeObject(obje, Formatting.None);
                        return(CommonClass.MiniFyAndCompressData(JsonResult));
                    }
                }
                catch (JsonSerializationException exception)
                {
                    AppLogger.LogError(exception);
                    throw;
                }


                return(obje);
            }
        }
コード例 #17
0
        public List <IAHeaders> GetDataIrregAlt(int id, string strSP)
        {
            List <IAHeaders> getData = new List <IAHeaders>();
            SqlConnection    con     = new SqlConnection(ConString);
            SqlCommand       cmd     = new SqlCommand(strSP, con);
            SqlDataReader    reader  = null;

            AddInParameter(cmd, "@id", Convert.ToString(id));
            try
            {
                cmd.CommandType = CommandType.StoredProcedure;
                con.Open();
                reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    IAHeaders irregAlt = new IAHeaders();
                    if (reader["IsDynamicCheck"] != DBNull.Value)
                    {
                        irregAlt.DynamicCheck = reader["IsDynamicCheck"] == null ? false : true;
                    }
                    if (reader["IAType"] != DBNull.Value)
                    {
                        irregAlt.IAType = reader["IAType"].ToString();
                    }
                    if (reader["InternalEpcNumber"] != DBNull.Value)
                    {
                        irregAlt.InternalEpcNumber = reader["InternalEpcNumber"].ToString();
                    }

                    if (reader["InfoNumber"] != DBNull.Value)
                    {
                        irregAlt.InfoNumber = reader["InfoNumber"].ToString();
                    }
                    if (reader["Description"] != DBNull.Value)
                    {
                        irregAlt.Description = reader["Description"].ToString();
                    }

                    if (reader["ValidPeriodFrom"] != DBNull.Value)
                    {
                        irregAlt.ValidPeriodFrom = Convert.ToDateTime(reader["ValidPeriodFrom"]);
                    }
                    if (reader["ValidPeriodTo"] != DBNull.Value)
                    {
                        irregAlt.ValidPeriodTo = Convert.ToDateTime(reader["ValidPeriodTo"]);
                    }
                    if (reader["ImplementationDate"] != DBNull.Value)
                    {
                        irregAlt.ImplementationDate = Convert.ToDateTime(reader["ImplementationDate"]);
                    }
                    getData.Add(irregAlt);
                }
            }
            catch (Exception e)
            {
                AppLogger.LogError(e);
            }
            finally
            {
                con.Close();
                con.Dispose();
            }
            return(getData);
        }
コード例 #18
0
        public static bool ProcessSyncData(string packingMonth, int modelId)
        {
            using (AppDb context = new AppDb())
            {
                DateTime dtPackingMonth = Convert.ToDateTime(packingMonth);

                Model oModel = context.Models.FirstOrDefault(p => p.Id == modelId);

                string asyncConnString = context.Database.Connection.ConnectionString;

                using (SqlConnection conn = new SqlConnection(asyncConnString))
                {
                    if (conn.State == ConnectionState.Closed)
                    {
                        conn.Open();
                    }

                    SqlCommand cmd = new SqlCommand();
                    cmd.CommandText    = "EXEC usp_GetCGISStagingData @vpm, @model";
                    cmd.CommandTimeout = 7000;
                    cmd.Parameters.AddWithValue("@vpm", dtPackingMonth.ToString("yyyyMM"));
                    cmd.Parameters.AddWithValue("@model", oModel.ModelName);
                    cmd.Connection = conn;

                    try
                    {
                        cmd.ExecuteNonQuery();
                    }
                    catch (SqlException se)
                    {
                        AppLogger.LogError(se);
                        return(false);
                    }

                    cmd                = new SqlCommand();
                    cmd.CommandText    = "EXEC usp_ProcessCGISFromStaging @vpm, @model";
                    cmd.CommandTimeout = 7000;
                    cmd.Parameters.AddWithValue("@vpm", dtPackingMonth.ToString("yyyyMM"));
                    cmd.Parameters.AddWithValue("@model", oModel.ModelName);
                    cmd.Connection = conn;

                    try
                    {
                        cmd.ExecuteNonQuery();
                    }
                    catch (SqlException se)
                    {
                        AppLogger.LogError(se);
                        return(false);
                    }

                    CGISSynchronized csync = new CGISSynchronized();
                    csync.PackingMonth = dtPackingMonth.ToString("yyyyMM");
                    csync.ProcessDate  = DateTime.Now;
                    csync.TypeId       = oModel.TypeId.GetValueOrDefault();
                    csync.ModelId      = modelId;
                    csync.ProcessBy    = "Admin"; //TODO:Change to current apps logger
                    context.CGISSynchronizeds.Add(csync);
                    context.SaveChanges();
                }
            }
            return(true);
        }
コード例 #19
0
        protected void Btn_Save(object sender, EventArgs e)
        {
            try
            {
                double NilMax     = 0;
                double NilMin     = 0;
                var    SumRowData = GridviewToolVerification.VisibleRowCount;
                ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage", @"alert('Verification Success !');", true);
                for (int i = 0; i < SumRowData; i++)
                {
                    //var rowIndex = e.VisibleIndex;

                    var varGetData = GridviewToolVerification.FindDetailRowTemplateControl(i, "LayoutDetails") as ASPxFormLayout;
                    if (varGetData != null)
                    {
                        var ValSetNm           = GridviewToolVerification.GetRowValues(i, "SetNM");
                        var convertIntValSetNM = ValSetNm == null ? "" : ValSetNm.ToString();
                        if (float.Parse(convertIntValSetNM.Split(',')[0]) < 10)
                        {
                            var Persentase = float.Parse(convertIntValSetNM.Split('.')[0]) * 0.02;
                            NilMax          = float.Parse(convertIntValSetNM.Split('.')[0]) + Persentase;
                            NilMin          = float.Parse(convertIntValSetNM.Split('.')[0]) - Persentase;
                            HiddenMax.Value = NilMax.ToString();
                            HiddenMin.Value = NilMin.ToString();
                        }
                        else
                        {
                            var Persentase = float.Parse(convertIntValSetNM.Split('.')[0]) * 0.03;
                            NilMax          = float.Parse(convertIntValSetNM.Split('.')[0]) + Persentase;
                            NilMin          = float.Parse(convertIntValSetNM.Split('.')[0]) - Persentase;
                            HiddenMax.Value = NilMax.ToString();
                            HiddenMin.Value = NilMin.ToString();
                        }
                        var GetSetNm  = varGetData.FindControl("Text_NM") as ASPxTextBox;
                        var GetSetMin = varGetData.FindControl("Text_Min") as ASPxTextBox;
                        var GetSetMax = varGetData.FindControl("Text_Max") as ASPxTextBox;
                        GetSetNm.Text  = ValSetNm.ToString();
                        GetSetMax.Text = NilMax.ToString();
                        GetSetMin.Text = NilMin.ToString();
                        var      ValueId        = GridviewToolVerification.GetRowValues(i, "ToolId");
                        var      ValueInventory = GridviewToolVerification.GetRowValues(i, "Id");
                        var      NextDayGet     = GridviewToolVerification.GetRowValues(i, "VerDay");
                        DateTime today          = DateTime.Now;

                        var ValueToolSetupId          = GridviewToolVerification.GetRowValues(i, "Id");
                        var ValueNextVerificationDate = GridviewToolVerification.GetRowValues(i, "Id");
                        //var iList = ToolVerificationRepository.RetrieveDataToolVerification("ToolVerification_GetData", ValueId.ToString(), ValueInventory.ToString());
                        var Attempt    = varGetData.FindControl("lbl_Attempt") as ASPxTextBox;
                        var ValAttempt = Attempt.Text == "ASPxLabel" ? 1 : int.Parse(Attempt.Text) + 1;
                        var InvString  = ValueInventory.ToString();
                        if (ValAttempt > 3)
                        {
                            ValAttempt = 3;
                        }
                        for (int u = 0; u < ValAttempt; u++)
                        {
                            var VerifNumb        = u + 1;
                            var GetVerDate       = varGetData.FindControl("lblVerificationDate") as ASPxLabel;
                            var GetToolSetupId   = varGetData.FindControl("lblInventoryNumber") as ASPxLabel;
                            var GetText_Min      = varGetData.FindControl("Text_Min") as ASPxTextBox;
                            var GetText_Max      = varGetData.FindControl("Text_Max") as ASPxTextBox;
                            var GetVerification1 = varGetData.FindControl("text_ver" + VerifNumb + "_" + "1") as ASPxTextBox;
                            var GetVerification2 = varGetData.FindControl("text_ver" + VerifNumb + "_" + "2") as ASPxTextBox;
                            var GetVerification3 = varGetData.FindControl("text_ver" + VerifNumb + "_" + "3") as ASPxTextBox;
                            //var ValText_VerDate = iList[0].LastVerificationDate.ToString();
                            var      ValCalNumber          = "1";
                            var      ValTollSetupId        = ValueToolSetupId.ToString();
                            var      ValTollInv            = ValueInventory.ToString();
                            var      ValText_NM            = ValSetNm.ToString();
                            var      ValText_Min           = GetText_Min.Text;
                            var      ValText_Max           = GetText_Max.Text;
                            var      ValText_Verification1 = GetVerification1.Text;
                            var      ValText_Verification2 = GetVerification2.Text;
                            var      ValText_Verification3 = GetVerification3.Text;
                            var      VerifNumberString     = VerifNumb.ToString();
                            DateTime ValueNext             = today.AddDays(int.Parse(NextDayGet.ToString() == "" ? "0" : NextDayGet.ToString()));
                            User     user      = (User)Session["user"];
                            var      CreatedBy = user.UserName;
                            ToolVerificationRepository.SaveDataToolVerification(ValueNext, VerifNumberString, InvString, ValCalNumber, ValueId.ToString(), ValTollInv, ValText_NM, ValText_Min, ValText_Max, ValText_Verification1, ValText_Verification2, ValText_Verification3, ValTollInv, CreatedBy);
                        }
                    }
                }
                Response.Write(@"
                <script>
                alert('Save Success');
                setTimeout(function(){            
                window.location = '" + Request.RawUrl + @"';
                }, 2000);
                </script>");
                //Response.Redirect(Request.RawUrl);
            }
            catch (Exception ex)
            {
                AppLogger.LogError(ex);
            }
        }
コード例 #20
0
        protected void btnVerify_Click(object sender, EventArgs e)
        {
            ASPxButton btn = (sender as ASPxButton);

            var conditionalBtn = btn.CommandArgument;

            var userauthkey = ProductionRepository.CheckAuth(tbLogin.Text);

            // authkey


            tbLogin.Text = "";

            if (userauthkey == "" || userauthkey == null)
            {
                ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage2", @"alert('Your Auth Key not valid');", true);
                return;
            }
            //string line = _lineId;
            //var jcSerial = txtSerialNumberJC.Text;
            var prodSerial = txtSerialNumberProd.Text;

            try
            {
                if (ProductionRepository.CheckModelInSequence(prodSerial) == null)
                {
                    ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage", "alert('Model not found, please check Production Sequence !');", true);
                }

                else if (ProductionRepository.CheckVariantInSequence(prodSerial) == null)
                {
                    ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage", "alert('Variant not found, please check Production Sequence !');", true);
                }

                else if (string.IsNullOrWhiteSpace(ProductionRepository.CheckSerialNumberInSequence(prodSerial)))
                {
                    ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage", "alert('Serial Number/ VIN/ Order No : " + prodSerial + " Not Listed in Production Sequence!');", true);
                }
                else
                {
                    var stationId = ProductionRepository.GetFirstStation(assemblyTypeId);
                    //Check routing exist
                    //var CheckDataInFirstStation = ProductionRepository.GetVehicleCountInStation(stationId, _productionLineId);
                    var notif = ProductionRepository.IsExistProductionRoute(prodSerial, assemblyTypeId);


                    if (notif)
                    {
                        //TODO: Confirm what is the purpose for this
                        //TODO: Is it to make sure that if vehicle count in first station > 0, it will always fail
                        //if (CheckDataInFirstStation == 0)
                        //{

                        var CheckFinNumber = ProductionRepository.GetFinNumber(prodSerial, assemblyTypeId);
                        var prod           = ProductionRepository.GetProductionHistoryInMainLines(CheckFinNumber, assemblyTypeId);

                        if (prod == null)
                        {
                            if (!ProductionRepository.GetCapacityCountInStation(stationId, _productionLineId))
                            {
                                throw new Exception("Next Station Max Capacity");
                            }
                            else
                            {
                                //Insert new productionHistory. if it already exist in subassy, replace it with the current line
                                var histId = ProductionRepository.InsertProductionHistory(_productionLineId, assemblyTypeId, prodSerial, "");
                                var detail = ProductionRepository.InsertProductionHistoryDetail(histId, stationId, false, false, "");
                                ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage", @"alert('Check VIN Number data successfully !');window.location ='../Production/ProductionDashboard.aspx'", true);
                            }
                        }
                        else
                        {
                            ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage", @"alert('VIN Number is already used !');", true);
                        }

                        //}
                        //else
                        //        ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage", "alert('" + notif + "!');", true);
                    }
                    else
                    {
                        ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage", "alert('Production route is not found!');", true);
                    }
                }
            }
            catch (Exception ex)
            {
                AppLogger.LogError(ex.Message);
                ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage", @"alert('Failed. " + ex.Message + " !');", true);
            }
        }
コード例 #21
0
        protected void btnPrintNIK_OnClick(object sender, EventArgs e)
        {
            try
            {
                ASPxButton btn = (sender as ASPxButton);
                //int id = Convert.ToInt32(btn.CommandArgument);
                LoadData();
                //ASPxButton btn = sender as ASPxButton;
                GridViewDataItemTemplateContainer container = btn.NamingContainer as GridViewDataItemTemplateContainer;
                var Rowindex = container.VisibleIndex;
                //int id = int.Parse(grid.GetRowValues(Rowindex, "FINNumber").ToString());
                int id = int.Parse(grid.GetRowValues(Rowindex, "Id").ToString());
                if (id != 0 || id != null)
                {
                    string query = @"UPDATE VPCStorage SET PrintNIK = GETDATE() WHERE Id=" + Convert.ToString(id);

                    AppDb   context = new AppDb();
                    DataSet dsData  = new DataSet();
                    using (SqlConnection conn = new SqlConnection(context.Database.Connection.ConnectionString))
                    {
                        if (conn.State == ConnectionState.Closed)
                        {
                            conn.Open();
                        }

                        using (SqlCommand cmd = new SqlCommand())
                        {
                            cmd.CommandText    = query;
                            cmd.CommandTimeout = 7000;
                            cmd.CommandType    = CommandType.Text;
                            cmd.Connection     = conn;
                            cmd.ExecuteNonQuery();
                        }
                    }

                    NIK    nik       = VehicleOrderRepository.getNIKNumber();
                    string message   = nik.Message;
                    string nikNumber = nik.NIKNumber;
                    if (!string.IsNullOrWhiteSpace(message))
                    {
                        //grid.JSProperties["cpalertmessage"] = message;
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "alert('" + message + "');", true);
                    }
                    else
                    {
                        string user = ((User)Session["user"]).UserName;
                        SqlDataSource1.UpdateCommand = "UPDATE VPCStorage SET PrintNIKBy ='" + user + "', NIKNumber='" + nikNumber + "' WHERE Id =" + id;
                        SqlDataSource1.Update();

                        string FinNo          = VehicleOrderRepository.GetFINNo(id);
                        string queryStringStd = "?FINNumber=" + FinNo;

                        Page.Response.Redirect("~/custom/Report/ReportNIK.aspx" + queryStringStd);
                    }
                    //Response.Redirect(Request.RawUrl);
                    LoadData();
                }
            }
            catch (Exception ex)
            {
                AppLogger.LogError(ex);
            }
        }